// utils.h
#ifndef UTILS_H
#define UTILS_H

#include <QString>
#include <QPoint>
#include <vector>
#include <algorithm>

namespace Utils {
    inline QString getLevelsDirectory() {
        return "levels/";
    }

    inline QPoint gridToScreen(const QPoint &gridPos, int cellSize) {
        return QPoint(gridPos.y() * cellSize, gridPos.x() * cellSize);
    }

    inline QPoint screenToGrid(const QPoint &screenPos, int cellSize) {
        return QPoint(screenPos.y() / cellSize, screenPos.x() / cellSize);
    }

    template <typename T>
    inline bool contains(const std::vector<T> &vec, const T &value) {
        return std::find(vec.begin(), vec.end(), value) != vec.end();
    }
}

#endif // UTILS_H
